#ifdef MBM_IMIBASE_SUPPORT
#include "mbm_spreadtrum_inc.h"

#include "mbm_typedefine.h"
#include "mbm_sys_adapter.h"
#include "mbm_vui_adapter.h"

#include "mbm_mw_adapter.h"


#ifdef MBM_MW_DEBUG
#define MW_TRACE mbm_trace
#else
#ifdef MW_TRACE
#undef MW_TRACE
#endif
#define MW_TRACE
#endif


void mbm_create_mw_window(void);

//static or gloable variable
static t_mbm_keyhandler g_mbm_mw_keyhandler = NULL;
static t_mbm_tphandler g_mbm_mw_tphandler = NULL;
static t_mbm_applet_state_handler g_mbm_mw_state_handler = NULL;


void mbm_mw_reg_key_handler(t_mbm_keyhandler hdr)
{
	g_mbm_mw_keyhandler = hdr;
}

void mbm_mw_excute_key_handler(Int32 key_event, Int32 key_code)
{
	if(g_mbm_mw_keyhandler != NULL)
	{
		g_mbm_mw_keyhandler(key_event, key_code);
	}
}

void mbm_mw_reg_tp_handler(t_mbm_tphandler hdr)
{
    g_mbm_mw_tphandler = hdr; 
}

void mbm_mw_excute_tp_handler(Int32 tp_event, Int32 x, Int32 y)
{
	if(g_mbm_mw_tphandler != NULL)
	{
		g_mbm_mw_tphandler(tp_event, x, y);
	}
}

void mbm_mw_reg_state_handler(t_mbm_applet_state_handler hdr)
{
	g_mbm_mw_state_handler = hdr;
}

void mbm_mw_excute_state_handler(Int32 state,Int32 scaleLevel)
{
	if(g_mbm_mw_state_handler != NULL)
	{
		g_mbm_mw_state_handler(state,scaleLevel);
	}
}

static UInt32 g_mbm_owner;

UInt32 mbm_set_owner(UInt32 owner)
{
    g_mbm_owner |= owner;
    
    return g_mbm_owner;
}

void mbm_clear_owner(UInt32 owner)
{
    g_mbm_owner &= ~owner;
}

UInt32 mbm_get_owner(void)
{
    return g_mbm_owner;
}


#endif /* MBM_IMIBASE_SUPPORT */
